package com.hc.javabasestudyproject.feature.functionalInterface;

/**
 *lambda表达式就是简写匿名内部类，要求类必须是接口且只有一个抽象方法
 */
public class MyInterface {
    public static <T> T calculateNum(IMyInterface<T> myInterface){
        return myInterface.test();
    }
    public static void main(String[] args) {
        IMyInterface<String> iMyInterface1 = new IMyInterface<String>() {
            @Override
            public String test() {
                return "自定义数据";
            }
        };
        String s = calculateNum(() -> "hello wold");

        IMyInterface iMyInterface = () -> "你好";
        System.out.println(iMyInterface.test());
    }
}
